package uit.uthuoc.dal;

import java.util.ArrayList;

import android.content.Context;
import android.text.Html;

import com.uit.uthuoc.R;



public class DrugDTO {
	private int mID;	//primary key
	private String mDrugCode;	//ma_thuoc
	private String mDrugName;	//ten_thuoc
	private String mManufacturer;	//nha_san_xuat
	private String mDistributor;	//nha_phan_phoi
	private String mContent;	//thanh_phan
	private String mIndications;	//chi_dinh
	private String mDosage;	//lieu_dung
	private String mAdministration;	//cach_dung
	private String mContraindications;	//chong_chi_dinh
	private String mSpecialPrecautions;	//than_trong
	private String mAdverseReactions;	//phan_ung_co_hai
	private String mInteractions;	//tuong_tac_thuoc
	private MIMSClassDTO mMIMSClass;	//phan_loai_MIMS
	private String mPackage;	//dong_goi
	
	

	
	
	// get set ...

	public int getID() {
		return mID;
	}

	public void setID(int mID) {
		this.mID = mID;
	}

	public String getDrugCode() {
		return mDrugCode;
	}

	public void setDrugCode(String mDrugCode) {
		this.mDrugCode = mDrugCode;
	}

	public String getDrugName() {
		return mDrugName;
	}

	public void setDrugName(String mDrugName) {
		this.mDrugName = mDrugName;
	}

	public String getManufacturer() {
		return mManufacturer;
	}

	public void setManufacturer(String mManufacturer) {
		this.mManufacturer = mManufacturer;
	}

	public String getDistributor() {
		return mDistributor;
	}

	public void setDistributor(String mDistributor) {
		this.mDistributor = mDistributor;
	}
	
	public String getContent() {
		return mContent;
	}

	public void setContent(String mContent) {
		this.mContent = mContent;
	}

	public String getIndications() {
		return mIndications;
	}

	public void setIndications(String mIndications) {
		this.mIndications = mIndications;
	}
	
	public String getDosage() {
		return mDosage;
	}

	public void setDosage(String mDosage) {
		this.mDosage = mDosage;
	}

	public String getAdministration() {
		return mAdministration;
	}

	public void setAdministration(String mAdministration) {
		this.mAdministration = mAdministration;
	}

	public String getContraindications() {
		return mContraindications;
	}

	public void setContraindications(String mContraindications) {
		this.mContraindications = mContraindications;
	}

	public String getSpecialPrecautions() {
		return mSpecialPrecautions;
	}

	public void setSpecialPrecautions(String mSpecialPrecautions) {
		this.mSpecialPrecautions = mSpecialPrecautions;
	}

	public String getAdverseReactions() {
		return mAdverseReactions;
	}

	public void setAdverseReactions(String mAdverseReactions) {
		this.mAdverseReactions = mAdverseReactions;
	}

	public String getInteractions() {
		return mInteractions;
	}

	public void setInteractions(String mInteractions) {
		this.mInteractions = mInteractions;
	}
	
	public MIMSClassDTO getMIMSClass() {
		return mMIMSClass;
	}

	public void setMIMSClass(MIMSClassDTO mMIMSClass) {
		this.mMIMSClass = mMIMSClass;
	}

	public String getPackage() {
		return mPackage;
	}

	public void setPackage(String package1) {
		mPackage = package1;
	}
	// end get set

	

	@Override
	public String toString() {
		return getDrugName();
	}

	public ArrayList<NameValueDTO> toNameValue(Context context) {
		ArrayList<NameValueDTO> result = new ArrayList<NameValueDTO>();
		
		NameValueDTO nameValue = new NameValueDTO();
		
		
		nameValue.setName(context.getString(R.string.drug_details_lbContent));
		nameValue.setValue(getContent());
		result.add(new NameValueDTO(nameValue));

		nameValue.setName(context.getString(R.string.drug_details_lbIndications));
		nameValue.setValue(getIndications());
		result.add(new NameValueDTO(nameValue));

		nameValue.setName(context.getString(R.string.drug_details_lbDosage));
		nameValue.setValue(getDosage());
		result.add(new NameValueDTO(nameValue));

		nameValue.setName(context.getString(R.string.drug_details_lbAdministration));
		nameValue.setValue(getAdministration());
		result.add(new NameValueDTO(nameValue));

		nameValue.setName(context.getString(R.string.drug_details_lbContraindications));
		nameValue.setValue(getContraindications());
		result.add(new NameValueDTO(nameValue));

		nameValue.setName(context.getString(R.string.drug_details_lbSpecialPrecautions));
		nameValue.setValue(getSpecialPrecautions());
		result.add(new NameValueDTO(nameValue));

		nameValue.setName(context.getString(R.string.drug_details_lbAdverseReactions));
		nameValue.setValue(getAdverseReactions());
		result.add(new NameValueDTO(nameValue));

		nameValue.setName(context.getString(R.string.drug_details_lbInteractions));
		nameValue.setValue(getInteractions());
		result.add(new NameValueDTO(nameValue));

		nameValue.setName(context.getString(R.string.drug_details_lbMIMSClass));
		// A link to specified MIMSCLass search activity
		nameValue.setValue(Html.fromHtml("<a href='" + "uit.uthuoc.activity.DrugSearchActivity://uthuocHost/" + getMIMSClass().getID() + "' >" + getMIMSClass() + "</a>"));
		result.add(new NameValueDTO(nameValue));
		
		nameValue.setName(context.getString(R.string.drug_details_lbPackage));
		nameValue.setValue(getPackage());
		result.add(new NameValueDTO(nameValue));
		
		nameValue.setName(context.getString(R.string.drug_details_lbManufaturer));
		nameValue.setValue(getManufacturer());
		result.add(new NameValueDTO(nameValue));
		
		nameValue.setName(context.getString(R.string.drug_details_lbDistributor));
		nameValue.setValue(getDistributor());
		result.add(new NameValueDTO(nameValue));

		// remove items "dang cap nhat"
		ArrayList<NameValueDTO> temp = new ArrayList<NameValueDTO>();
		for (NameValueDTO nv : result) {
			if (nv.getValue().toString().compareTo(DrugDAO.DB_DEFAULT_VALUE) != 0)
			{
				temp.add(nv);
				
			}
		}
		
		return temp;
	}

	

	

	
	
	
}
